<#assign wrapperPackage="${package.Entity}"?replace("entity","wrapper")/>
<#assign shortEntityClass="${entity}"?replace("Entity","")/>
<#assign voPackage="${package.Entity}"?replace("entity","vo")/>
package ${wrapperPackage};

import ormosia.hosiei.demon.mp.base.BaseWrapper;
import ormosia.hosiei.demon.tools.base.BeanUtil;
import ${package.Entity}.${entity};
import ${voPackage}.${shortEntityClass}VO;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* PackageName:  ${wrapperPackage}
* ClassName:    ${shortEntityClass}Wrapper
* Description:  ${table.comment!} 服务实现类
* Author:       ${author}
* Date:         ${date}
**/
public class ${shortEntityClass}Wrapper extends BaseWrapper<${entity}, ${shortEntityClass}VO>  {

    public static ${shortEntityClass}Wrapper build() {
        return new ${shortEntityClass}Wrapper();
     }

    @Override
    public ${shortEntityClass}VO entityVO(${entity} ${table.entityPath}) {
        ${shortEntityClass}VO ${table.entityPath}VO = Objects.requireNonNull(BeanUtil.copy(${table.entityPath}, ${shortEntityClass}VO.class));
        return ${table.entityPath}VO;
    }

    public List<${entity}> listEntity(List<${shortEntityClass}VO> list) {
        if (CollectionUtils.isEmpty(list)) {
            return new ArrayList<>();
        }
        return list.stream().map(item -> {
            ${entity} entity = new ${entity}();
            BeanUtil.copyProperties(item, entity);
            return entity;
        }).collect(Collectors.toList());
    }

}